package section17;
import java.io.FileNotFoundException;
import java.sql.*;

public class App17_19 {

    private static String driver="com.mysql.cj.jdbc.Driver";
    public static String url="jdbc:mysql://localhost:3306/dorm_admin_sys?characterEncoding=utf-8&serverTimezone=UTC";
    private static String user="root";
    private static String passwd="mysql";

    public static void main(String[] args) {
        try (Connection conn=DriverManager.getConnection(url,user,passwd)){
            Class.forName(driver);

            DatabaseMetaData dmd= conn.getMetaData();
            System.out.println("数据库名："+dmd.getDatabaseProductName());
            System.out.println("数据库版本："+dmd.getDatabaseProductVersion());
            System.out.println("驱动程序名："+dmd.getDriverName());
            System.out.println("数据库url:"+dmd.getURL());
            System.out.println("数据类型的描述："+
                    dmd.getTypeInfo());
        }
        catch (Exception e){e.printStackTrace();}
    }
}
